<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html lang="en" xmlns:th=“http://www.thymeleaf.org”>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="Bookmark" href="/favicon.ico" >
    <link rel="Shortcut Icon" href="/favicon.ico" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="lib/html5shiv.js"></script>
    <script type="text/javascript" src="lib/respond.min.js"></script>

    <![endif]-->
    <link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css" />

    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <!--/meta 作为公共模版分离出去-->

    <link href="lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
</head>
<body>

<div class="page-container">
    <article  class="page-container">
    <form   id="form-admin-add">
        <div class="row cl">

            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>使用人：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text"  class="input-text" value="" placeholder="请输入使用人" id="" name="c_userName">


            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">合同编号：</label>
            <div class="formControls col-xs-8 col-sm-9">
            <input type="text" class="input-text"  onclick="clickMath()" value="" placeholder="请输入合同编号" readonly="readonly" name="c_contractid"  id="ceil" >
        </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">车位编号：</label>
            <div class="formControls col-xs-8 col-sm-9"> <span class="select-box" style="width:150px;">
			<select class="select" name="c_number" size="1">
				<option th:each="role:${carseat}" th:value="${role.cS_number}" th:text="${role.cS_number}"></option>
			</select>
			</span> </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">车牌号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="请输入车牌号" id="" name="c_carNumber">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">联系电话：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="请输入联系电话" id="cha" name="c_phone">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">租期时间：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd HH:mm:ss',maxDate:'#F{$dp.$D(\'datemax\')||\'%y-%M-%d\'}' })" placeholder="请输入租期开始时间" id="datemin" class="input-text Wdate" style="width:180px;" name="c_date">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">到期时间：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'datemin\')}' })" placeholder="请输入到期时间" id="datemax" class="input-text Wdate" style="width:180px;" name="c_endDate">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">购买价格：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="请输入购买价格" id="" name="c_goodcost">
                </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">合同类型：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="" placeholder="请输入合同类型" id="" name="c_type">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">签订日期：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'datemin\')}' })" placeholder="请输入签订日期" id="datemax" class="input-text Wdate" style="width:180px;" name="c_signdate">
            </div>
        </div>

        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                <button  class="btn btn-default radius" type="submit">&nbsp;&nbsp;提交&nbsp;&nbsp;</button>
                <button  class="btn btn-default radius" type="reset">&nbsp;&nbsp;重置&nbsp;&nbsp;</button>

            </div>
        </div>

    </form>
</article>

</div>

<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="lib/webuploader/0.1.5/webuploader.min.js"></script>
<script type="text/javascript" src="lib/ueditor/1.4.3/ueditor.config.js"></script>
<script type="text/javascript" src="lib/ueditor/1.4.3/ueditor.all.min.js"> </script>
<script type="text/javascript" src="lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
<script>
    //验证电话只能输入数字
    $('#cha')
        .keyup(
            function() {
                this.value = this.value
                    .replace(
                        /([\u4E00-\u9FA5]|[A-Za-z])+/,
                        '')
                    .replace(/[^\d]/, '')
                    .replace(/.*\..*/, '')
                    .replace(/^0/, '')
                    .replace(
                        /[\u3002|\uff1f|\uff01|\uff0c|\u3001|\uff1b|\uff1a|\u201c|\u201d|\u2018|\u2019|\uff08|\uff09|\u300a|\u300b|\u3008|\u3009|\u3010|\u3011|\u300e|\u300f|\u300c|\u300d|\ufe43|\ufe44|\u3014|\u3015|\u2026|\u2014|\uff5e|\ufe4f|\uffe5]/,
                        '');
            });

</script>


<script>
    //随机生成合同编号和添加合同
    function clickMath(){

        var ceil = Math.ceil(Math.random()*9)+""+Math.ceil(Math.random()*9)+""+Math.ceil(Math.random()*9)+""+Math.ceil(Math.random()*9)+""+Math.ceil(Math.random()*9)+""+Math.ceil(Math.random()*9)+""+Math.ceil(Math.random()*9)+""+Math.ceil(Math.random()*9)+""+Math.ceil(Math.random()*9)+""+Math.ceil(Math.random()*9);

        document.getElementById("ceil").value = ceil;

    }
</script>
<script>
    $("#form-admin-add").validate({
        rules:{
            c_userName:{
                required:true,
                minlength:2,
                maxlength:10
            },
            c_contractid:{
                required:true,
            },
            c_carNumber:{
                required:true,
            },
            c_phone:{
                required:true,
                isPhone:true,
            },
            c_goodcost:{
                required:true,
            },
            c_type:{
                required:true,
            },
        },
        onkeyup:false,
        focusCleanup:true,
        success:"valid",
        submitHandler:function(form){
            $(form).ajaxSubmit({
                type: 'post',
                url: "addcarcontract" ,
                success: function(data){
                    layer.alert(data)
                    layer.msg('添加成功!',{icon:1,time:1000});
                },
                error: function(XmlHttpRequest, textStatus, errorThrown){
                    layer.msg('error!',{icon:1,time:1000});
                }
            });
            var index = parent.layer.getFrameIndex(window.name);
            parent.location.reload();
            parent.$('.btn-refresh').click();
            parent.layer.close(index);
        }
    });


</script>
<script>
    function isVehicleNumber(vehicleNumber) {
        var result = false;
        if (vehicleNumber.length == 7){
            var express = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/;
            result = express.test(vehicleNumber);
        }
        return result;
    }
</script>


</body>
</html>